/*
 ============================================================================
 Name		: TradeFundEntrustRansom.h
 Author	  : spring xu
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CTradeFundEntrustRansom declaration
 ============================================================================
 */

#ifndef TRADEFUNDENTRUSTRANSOM_H
#define TRADEFUNDENTRUSTRANSOM_H

// INCLUDES
#include "TradeBlock.h"
#include "Control.h"
#include "TradeBlockNetwork.h"

// CLASS DECLARATION

class CTradeFundEntrustRansom : public CTradeBlock, public MPushButtonObserver //,public MReqObserver
{   
public:
    ~CTradeFundEntrustRansom();

    static CTradeFundEntrustRansom* NewL(CBaseBlock* bsBack, TBool bHasReq = EFalse);

    static CTradeFundEntrustRansom* NewLC(CBaseBlock* bsBack, TBool bHasReq = EFalse);

private:
    CTradeFundEntrustRansom(CBaseBlock* bsBack, TBool bHasReq = EFalse);
    
    void ConstructL();

public:
    void OnDraw(CFbsBitGc& g) const;

    void OnKeyDown(TInt keyCode);

    void OnMouseDown(const TPoint& aPt);
    
    void OnMouseUp(const TPoint& aPt);
    
    void OnInput(const TDesC8& strInput);

    void SizeChanged();  
    
    void ChangeFocus(TBool aFoucs, const TInt& keyCode);
    
    void BeforeBack();
    
public:
	TBool SetInfoIndex(TInt nIndex);
    
protected:
    void AddTabs();

    void BeforeDraw(CFbsBitGc& g) const;
    
private:
    void CreateControls();    
    void LayoutControls();
    
    void InitNetworkData();
    void Query();
    void ResetData();
    
    TBool SetControlData(TInt nIndex);
    TBool AppendSelectBoxFundCodeArray(p_ofhold_record_info_t pArray, int nCount);
    
public:    
    // from MPushButtonObserver
    void PushButtonClicked();
    
public:
	TBool ProcessTradeNetworkMsg(TInt nError, TAny* p, const TDesC8& aBodyData);
	//TBool UpdateTradeNetwork(TInt nProgress);
		
private:
	enum TControl
	{
		EFundRansomControl_SelectBoxFundName,
		EFundRansomControl_FundCode,
		EFundRansomControl_SelectBoxType,
		
		EFundRansomControl_UseAmount,
		EFundRansomControl_CurrentAmount,
		
		EFundRansomControl_ButtonConfirm,
		EFundRansomControl_ButtonReset,
		
		EFundRansomControlCount
	};
    enum TNetworkStatus
    {
    	ENetworkStatus_None,
    	ENetworkStatus_ReqFundVolume,
    	ENetworkStatus_ReqRansom,
    	ENetworkStatus_Resp,
    };
private:
/*    enum TRansomType
    {
        EToSecurity, ESToBank
    };
    TRansomType iType;*/
    
    CLabelSelectBox* iSelectBoxFundName;
    CSingleLineTextInput* iFundCode;
    CLabelSelectBox* iSelectBoxRansomType;
    CSingleLineTextInput* iUseAmount;
    CSingleLineTextInput* iCurrentAmount;
    
    CPushButton* iButtonConfirm;
    CPushButton* iButtonReset;
    
    CControl* iControls[EFundRansomControlCount];
    TInt iFocusControl;
    
    TInt iNetworkStatus;
    
    TBool ibHasReq;
};

#endif // TRADEBLOCKTRANSFER_H
